<?$this->_extends("_layouts/main_layout");?>
<?$this->_block("contents");?>
<script type="text/javascript">
<!--
function isdelete(can){
	if (can) {
		return confirm("确定要删除？");
	}
	alert("该类型下有子类或者已有新闻，不能删除，请先删除该类的子类或者新闻！");
	return false;
}
//-->
</script>
<?php if (hp('newstype.2')) {?>
<input type="button" class="btn1" value="添加"  onclick="window.location.href='<?php echo url('newstype/create');?>';" style="width:80px;margin-top:7px;margin-bottom:7px;" />
<?php }?>
<table class="list_table" width="100%" cellpadding="0" cellspacing="0">
  <tr>
    <th width="">序号</th>
    <th width="">名称</th>
    <th width="">类型分类</th>
    <th width="">链接地址</th>
    <?php if (hp('newstype.3') || hp('newstype.4')) {?>
    <th width="">操作</th>
    <? }?>
  </tr>
  <?php
	//print_r($list);
	$count = 0;
	foreach ($list as $k => $v) {
		$count ++;
		$show = 1;
		if(!empty($news_op)){
			if(!in_array($k,$news_op)){
				$show = 0;	
			}
		}
		if($show == 1){
	 ?>
  <tr>
    <td><?php echo $count?></td>
    <td align="left" style=" text-align:left;"><?php
    if($v['value']['nav'] == 1){
      $name = '<font style="color:#cc9900">'.str_replace('━━','&nbsp;&nbsp;&nbsp;&nbsp;',$v['value']['type_name']).'</font>';
    }else{
      $name = str_replace('━━','&nbsp;&nbsp;&nbsp;&nbsp;',$v['value']['type_name']);
    }
    echo $name;
    ?></td>
    <td><?php echo $type_flag[$v['value']['type_flag']];?></td>
    <td><?php echo $v['value']['the_url'];?></td>
    <?php if (hp('newstype.3') || hp('newstype.4')) {?>
    <td>
    	<?php if (hp('newstype.3')) {?>
        	<a href="<?=url('newstype/edit', array('id'=>$k))?>" style="color:blue;" title="修改">[修改]</a>&nbsp;       	
        <?php }?>
        <?php if (hp('newstype.4')) {?>
        	<a href="<?=url('newstype/delete', array('id'=>$k))?>" onclick="return isdelete(<?php echo $v['can_delete'];?>)" style="color:blue;" title="删除">[删除]</a>
        <?php }?>
    </td>
    <? }?>
  </tr>
  <? }}?>
</table>
<br>
<? $this->_endblock();?>
